#include "UITest.h"
#include "StartMenu.h"
UITest::UITest( )
{
}


UITest::~UITest( )
{
}

bool UITest::init( )
{
	Layer::init( );
	 root_ui = GUIReader::getInstance( )->widgetFromJsonFile( "gameOver_layer/MoonWarrios_gameOver_layer.ExportJson" );
	 auto _size = root_ui->getChildrenCount( );

	 this->addChild( root_ui);
	testButton = dynamic_cast<Button*>(Helper::seekWidgetByName(root_ui,"GoBack"));
	testButton->addTouchEventListener(this, toucheventselector( UITest::TouchButton ) );

	return true;
}

Scene* UITest::createSence( )
{
	auto _s = Scene::create( );
	auto ui_test = UITest::create( );
	_s->addChild( ui_test );
	return _s;
}



void UITest::TouchButton( Ref*pSender, TouchEventType type )
{
	log("touch the button ..." );
	auto _s = Scene::create( );
	_s->addChild( StartMenu::create());
	Director::getInstance( )->replaceScene( TransitionFlipAngular::create( 1.2f, _s ) );



}
